﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="Default.aspx.cs" Inherits="ProductList" %>

<%@ Register Src="~/Controls/GridViewPager.ascx" TagName="GridViewPager" TagPrefix="asp" %>
<%@ Register Assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    Namespace="System.Web.UI.WebControls" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <h2>
        Products</h2>
    <asp:ScriptManagerProxy runat="server" ID="ScriptManagerProxy1" />
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <span>请选择设备分类 </span>
            <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" CssClass="droplist"
                DataSourceID="EntityDataSource2" DataTextField="Name" DataValueField="ID">
            </asp:DropDownList>
            <br />
            <br />
            <asp:GridView ID="GridView1" runat="server" DataSourceID="EntityDataSource1" AllowPaging="True"
                AllowSorting="True" CssClass="gridview" AutoGenerateColumns="False">
                <Columns>
                    <asp:BoundField DataField="Code" HeaderText="编号" ReadOnly="True" SortExpression="Code" />
                    <asp:BoundField DataField="Name" HeaderText="商品名称" ReadOnly="True" SortExpression="Name" />
                    <asp:BoundField DataField="CurrentPrice" HeaderText="当前价格" ReadOnly="True" SortExpression="CurrentPrice"
                        DataFormatString="￥{0}.00" />
                    <asp:TemplateField HeaderText="CPU" SortExpression="CPU">
                        <ItemTemplate>
                            <%# Eval("CPUName")%>
                            <%# Eval("CPU")%>
                            GHz
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="内存" SortExpression="RAM">
                        <ItemTemplate>
                            <%# Eval("RAM")%>
                            MB
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="硬盘" SortExpression="HD">
                        <ItemTemplate>
                            <%# Eval("HD")%>
                            GB
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="显示器" SortExpression="Monitor">
                        <ItemTemplate>
                            <%# Eval("Monitor")%>'<%#Eval("MonitorTypeValue")%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="其它" SortExpression="VGATypeValue">
                        <ItemTemplate>
                            <%# Eval("CDROMTypeValue")%>,
                            <%# Eval("VGATypeValue").ToString() == "集成显卡" ? Eval("VGATypeValue") : (Eval("VGACard").ToString()+"独显")%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="状态" SortExpression="IsFinished">
                        <ItemTemplate>
                            <%# Convert.ToBoolean(Eval("IsFinished").ToString())?"<font color=red>已结束</font>":"<font color=green>竞拍中</font>"%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:HyperLinkField HeaderText="查看" DataNavigateUrlFields="ID" DataNavigateUrlFormatString="~/ProductInfo.aspx?ID={0}"
                        Text="查看详细信息" />
                </Columns>
                <PagerStyle CssClass="footer" />
                <PagerTemplate>
                    <asp:GridViewPager runat="server" />
                </PagerTemplate>
                <EmptyDataTemplate>
                    There are currently no items in this table.
                </EmptyDataTemplate>
            </asp:GridView>
            <asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=NCCITPubSaleEntities"
                DefaultContainerName="NCCITPubSaleEntities" EntitySetName="VProduct" Select="it.[ID], it.[Code], it.[Name], it.[CurrentPrice], it.[IsFinished], it.[CPU], it.[CPUName], it.[RAM], it.[HD], it.[Monitor], it.[VGACard], it.[VGATypeValue], it.[CDROMTypeValue], it.[MonitorTypeValue]"
                OrderBy="it.[ID]">
                <%--                Where="it.Category.ID==@CategoryID"<WhereParameters>
                    <asp:ControlParameter ControlID="DropDownList1" Name="CategoryID" Type="Int32" PropertyName="SelectedValue" />
                </WhereParameters>--%>
            </asp:EntityDataSource>
            <asp:EntityDataSource ID="EntityDataSource2" runat="server" ConnectionString="name=NCCITPubSaleEntities"
                DefaultContainerName="NCCITPubSaleEntities" EntitySetName="Category">
            </asp:EntityDataSource>
            <br />
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
